<?php
/**
 * Created by PhpStorm.
 * User: kb112
 * Date: 2017/2/23
 * Time: 17:48
 */

namespace soa\order;

use soa\client;

class order extends client
{
    /**
     * @var string
     */
    protected $service_url = 'http://order.core.kuaidihelp.com/';

    /**
     * @var string
     */
    protected $service_name = 'kuaidihelp_order2';

    /**
     * 下单
     * @param $params
     * @return array|bool|null
     */
    public function place($params)
    {
        if (empty($params)) {
            return [];
        }
        return $this->post('v1/place/index', $params);
    }


    /**
     * 通过订单号获取订单信息
     * @param $orderNo
     * @param string $select
     * @return array|bool|null
     */
    public function getOrder($orderNo, $select = '*')
    {
        if (empty($orderNo)) {
            return [];
        }
        return $this->post('v1/get/byOrderNo', compact('orderNo', 'select'));
    }


    /*********************************************中通实名寄递 begin***********************************************/
    /**
     * 获取快递员的巴枪信息
     * @param $account
     * @return string
     */
    public function login($account)
    {
        if(empty($account) || !is_array($account)) {
            return '';
        }
        return $this->get('v1/zt/Realname/login', array('account' => $account));
    }

    /**
     * 用户实名信息上传
     * @param $account
     * @return string
     */
    public function uploadRealName($account,$data)
    {
        if(empty($account) || !is_array($account) || empty($data) || !is_array($data)) {
            return '';
        }
        return $this->post('v1/zt/Realname/uploadRealName', array('account' => $account,'data'=>$data));
    }

    /**
     * 全国用户实名信息上传
     * @param $account
     * @return string
     */
    public function uploadRealNameOfZt($account,$data)
    {
        if(empty($account) || !is_array($account) || empty($data) || !is_array($data)) {
            return '';
        }

        return $this->post('v1/zt/Realname/uploadRealNameOfZt', array('account' => $account,'data'=>$data));
    }

    /**
     * 全国寄收信息上传
     * @param $account
     * @return string
     */
    public function uploadSenderReceiveCountryOfZt($account,$data)
    {
        if(empty($account) || !is_array($account) || empty($data) || !is_array($data)) {
            return '';
        }

        return $this->post('v1/zt/Realname/uploadSenderReceiveCountryOfZt', array('account' => $account,'data'=>$data));
    }

    /*********************************************中通实名寄递 end***********************************************/



    /*********************************************申通实名寄递 begin*********************************************/
    
    public function stoZj(array $data)
    {
        if(empty($data)) {
            return '';
        }
        $t1 = microtime(true);
        $response = $this->post('v1/sto/Realname/stoZj', array('data'=>$data));
        $t2 = microtime(true);
        logDebug(round($t2-$t1,3).'秒');
        return $response;
    }

    public function stoCountry(array $data)
    {
        if(empty($data)) {
            return '';
        }
        $response = $this->post('v1/sto/Realname/stoCountry', array('data'=>$data));
        return $response;
    }

    /*********************************************申通实名寄递 end***********************************************/



}